<<<<<<< HEAD
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Ucenter extends CI_Controller {
	function __construct(){
		parent::__construct();
		
	}
	//用户安全退出
	public function logout(){
		setcookie("zhsjr_online",false,0,'/');
		$this->session->unset_userdata('rsh_user');
		$this->js->go('/zhs_mobile/login/index.html');
	}
	
	//****** 20141126 by liub 个人资料中心
	function index(){
		$user = $this->session->userdata('rsh_user');
		if(isset($user['user_id']) && $user['user_id'] > 0){
			// 1.获取用户信息
			$userid = $user['user_id'];
			$this->load->model('User_model');
			$data = array();
			$data['userInfo'] = $this->User_model->vipRank(array('user_id'=>$userid));
			// 2.获取资金信息
			$this->load->model('Account_model', 'account');
			$this->load->model('Borrow_model');
			// 账户信息
			$data['user_acnt'] = $this->account->get_account($userid);
			if(!$data['user_acnt']){// 账户无信息
				$initAccount = array(
					'user_id'      => $userid,
					'total'        => '0',// 账户总额
					'use_money'    => '0',// 可用
					'no_use_money' => '0',// 冻结
					'collection'   => '0',// 回款
					'cps_money'   => '0',// 推广
					'red_money'   => '0',// 代金券，代金卷
				);
				$account_id = $this->account->init_account($initAccount);
				if($account_id) {
					$initAccount['id'] = $account_id;
				}
				$data['user_acnt'] = $initAccount;
			}
			if(is_file('./static/data/avatar/'.$user['user_id'].'_avatar_big.jpg')){
				$data['photo'] = '/static/data/avatar/'.$user['user_id'].'_avatar_big.jpg';
			}else{
				$data['photo'] = '/static/zhsjr/mobile/images/mem_1.gif';
			}
			// 用户名
			//$data['username'] = $user['username'];
			// 投标收益总计
			$data['user_acnt']['income_total'] =  $this->account->income_total($userid);
			// 投标总额 = 理财资产
			$data['user_acnt']['invite_total'] = $this->Borrow_model->tender_total($userid);
			$data['tab'] = 2;
			$this->load->view('zhs_mobile/member',$data);
		}else{
			header('Location: /zhs_mobile/login/index.html');
		}
	}
	
	// 修改登录密码
	function xglogin(){
		$user = $this->session->userdata('rsh_user');
		$data = Array();
		if(isset($user['user_id']) && $user['user_id'] > 0){
			
		}else{
			header('Location: /zhs_mobile/login/index.html');
		}
		$data['tab'] = 2;
		$this->load->view('zhs_mobile/xglogin',$data);
	}
	
	// 查询交易密码
	function jylogin(){
		$user = $this->session->userdata('rsh_user');
		$data = Array();
		if(isset($user['user_id']) && $user['user_id'] > 0){
			
		}else{
			header('Location: /zhs_mobile/login/index.html');
		}
		$data['tab'] = 2;
		$this->load->view('zhs_mobile/jylogin',$data);
	}	
	
	// 查询实名认证信息
	function name(){
		$user = $this->session->userdata('rsh_user');
		$data = Array();
		if(isset($user['user_id']) && $user['user_id'] > 0){
			// 1.获取用户信息
			$userid = $user['user_id'];
			// 基本资料（一级）
			$this->load->model('User_model');
			$data['userInfo'] = $this->User_model->get_by_uid($userid);
			
			if(isset ($data['userInfo'] ) && $data['userInfo']['real_status'] == 0 ){
				$ret['msg'] = '敬请登陆一点投PC端官网实名认证';
				$ret['url_title'] = '返回';
				$ret['url_next']="/zhs_mobile/ucenter.html";
				$this->load->view('zhs_mobile/msg',$ret);
				return ;
			}else{
				//TODO 
			}
		}else{
			header('Location: /zhs_mobile/login/index.html');
		}
		$data['tab'] = 2;
		$this->load->view('zhs_mobile/name',$data);
	}
	
	// 查询手机认证信息
	function tel(){
		$user = $this->session->userdata('rsh_user');
		$data = Array();
		if(isset($user['user_id']) && $user['user_id'] > 0){
			// 1.获取用户信息
			$userid = $user['user_id'];
			// 基本资料（一级）
			$this->load->model('User_model');
			$data['userInfo'] = $this->User_model->get_by_uid($userid);
			
			if(isset ($data['userInfo'] ) && $data['userInfo']['phone_status']==0){
				$ret['msg'] = '敬请登陆一点投PC端官网手机认证';
				$ret['url_title'] = '返回';
				$ret['url_next']="/zhs_mobile/ucenter.html";
				$this->load->view('zhs_mobile/msg',$ret);
				return ;
			}
		}else{
			header('Location: /zhs_mobile/login/index.html');
		}
		$data['tab'] = 2;
		$this->load->view('zhs_mobile/tel',$data);
	}
	
	// 前往充值页面
	function recharge(){
		$user = $this->session->userdata('rsh_user');
		if(isset($user['user_id']) && $user['user_id'] > 0){
			$ret['msg'] = '敬请前往一点投金融PC端官网充值';
			$ret['url_title'] = '返回';
			$ret['url_next']="/zhs_mobile/ucenter.html";
			$this->load->view('zhs_mobile/msg',$ret);
		}else{
			header('Location: /zhs_mobile/login/index.html');
		}
	}
	
	// 前往提现页面
	function cash(){
		$user = $this->session->userdata('rsh_user');
		if(isset($user['user_id']) && $user['user_id'] > 0){
			$this->load->model('User_model', 'user');
			$this->load->model('Account_bank_model', 'bank');
			$this->load->model('Account_model', 'account');
			$this->load->model('Accountlog_model', 'accountlog');
			
			$data['user'] = $this->user->get_by_uid($user['user_id']);
			$data['bank_list'] = $this->bank->arrays('var_account_bank');
			$data['account'] = $this->account->get_account($user['user_id']);
			$data['bank'] = $this->bank->get_by_uid($user['user_id']);
			$data['cash_fee'] = $this->accountlog->cash_fee($user['user_id']);
			$data['cash_fee'] = min($data['cash_fee'],$data['account']['use_money']);
			
			if($data['user']['real_status'] != 1){
				$ret['msg'] = '尚未实名认证';
				$ret['url_title'] = '返回用户中心';
				$ret['url_next']="/zhs_mobile/ucenter.html";
				$this->load->view('zhs_mobile/msg',$ret);
				return;
			}elseif ((!isset($data['bank'])) || count($data['bank']) == 0 ){
				$ret['msg'] = '尚未填写银行账户';
				$ret['url_title'] = '返回用户中心';
				$ret['url_next']="/zhs_mobile/ucenter.html";
				$this->load->view('zhs_mobile/msg',$ret);
				return;
			}elseif (!$data['user']['paypassword']){
				$ret['msg'] = '尚设置交易密码';
				$ret['url_title'] = '返回用户中心';
				$ret['url_next']="/zhs_mobile/ucenter.html";
				$this->load->view('zhs_mobile/msg',$ret);
				return;
			}
			$data['tab'] = 2;
			$this->load->view('zhs_mobile/txye',$data);
		}else{
			header('Location: /zhs_mobile/login/index.html');
		}
	}
	
	// 充值日志
	function recharge_log(){
		$user = $this->session->userdata('rsh_user');
		$data = Array();
			$this->load->view('zhs_mobile/cz',$data);
			$ret['msg'] = '敬请登陆一点投金融PC端官网充值';
			$ret['url_title'] = '前往 用户中心';
			$ret['url_next']="/zhs_mobile/login/index.html";
			$this->load->view('zhs_mobile/msg',$ret);
	}
	
	// 提现日志
	function cash_log(){
		$user = $this->session->userdata('rsh_user');
		if(isset($user['user_id']) && $user['user_id'] > 0){
			$ret['msg'] = '敬请登陆一点投金融PC端官网充值';
			$ret['url_title'] = '前往 用户中心';
			$ret['url_next']="/zhs_mobile/ucenter.html";
			$this->load->view('zhs_mobile/msg',$ret);
		}else{
			header('Location: /zhs_mobile/login/index.html');
		}
		$data['tab'] = 2;
		$this->load->view('zhs_mobile/tx',$data);
	}
	
	// 资金日志
	function account_log(){
		$user = $this->session->userdata('rsh_user');
		if(isset($user['user_id']) && $user['user_id'] > 0){
			$ret['msg'] = '敬请登陆一点投金融PC端官网充值';
			$ret['url_title'] = '前往 用户中心';
			$ret['url_next']="/zhs_mobile/ucenter.html";
			$this->load->view('zhs_mobile/msg',$ret);
		}else{
			header('Location: /zhs_mobile/login/index.html');
		}
		$data['tab'] = 2;
		$this->load->view('zhs_mobile/zj',$data);
	}
	
	// 投资日志
	function tender_log(){
		$user = $this->session->userdata('rsh_user');
		if(isset($user['user_id']) && $user['user_id'] > 0){
			$ret['msg'] = '敬请登陆一点投金融PC端官网充值';
			$ret['url_title'] = '前往 用户中心';
			$ret['url_next']="/zhs_mobile/ucenter.html";
			$this->load->view('zhs_mobile/msg',$ret);
		}else{
			header('Location: /zhs_mobile/login/index.html');
		}
		$data['tab'] = 2;
		$this->load->view('zhs_mobile/tz',$data);
	}
	
	function zhs_bank(){
		$user = $this->session->userdata('rsh_user');
		$this->load->model('Account_bank_model', 'bank');
		$this->load->model('Area_model', 'area');
		$bank = $this->bank->get_by_uid($user['user_id']);
		$data['bank_list'] = $this->bank->arrays('var_account_bank');
		$data['area'] = $this->area->get_list();
		
		if(count($bank)<=0){
			$ret['msg'] = '敬请登陆一点投PC端绑定银行卡';
			$ret['url_title'] = '返回';
			$ret['url_next']="/zhs_mobile/ucenter.html";
			$this->load->view('zhs_mobile/msg',$ret);
			return ;
		}
		for($i=0; $i<count($bank); $i++){
			$data['bank'.$i] = $bank[$i];
		}
		$data['user'] = $user;
		$data['tab'] = 2;
		$this->load->view('zhs_mobile/bank',$data);
	}
=======
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Ucenter extends CI_Controller {
    function __construct(){
		parent::__construct();
		
	}
	//用户安全退出
	public function logout(){
		setcookie("zhsjr_online",false,0,'/');
		$this->session->unset_userdata('rsh_user');
		$this->js->go('/zhs_mobile/login/index.html');
	}
	
	//****** 20141126 by liub 个人资料中心
	function index(){
		$user = $this->session->userdata('rsh_user');
		if(isset($user['user_id']) && $user['user_id'] > 0){
			// 1.获取用户信息
			$userid = $user['user_id'];
			$this->load->model('User_model');
			$data = array();
			$data['userInfo'] = $this->User_model->vipRank(array('user_id'=>$userid));
			// 2.获取资金信息
			$this->load->model('Account_model', 'account');
			$this->load->model('Borrow_model');
			// 账户信息
			$data['user_acnt'] = $this->account->get_account($userid);
			if(!$data['user_acnt']){// 账户无信息
				$initAccount = array(
					'user_id'      => $userid,
					'total'        => '0',// 账户总额
					'use_money'    => '0',// 可用
					'no_use_money' => '0',// 冻结
					'collection'   => '0',// 回款
					'cps_money'   => '0',// 推广
					'red_money'   => '0',// 代金券，代金卷
				);
				$account_id = $this->account->init_account($initAccount);
				if($account_id) {
					$initAccount['id'] = $account_id;
				}
				$data['user_acnt'] = $initAccount;
			}
			if(is_file('./static/data/avatar/'.$user['user_id'].'_avatar_big.jpg')){
				$data['photo'] = '/static/data/avatar/'.$user['user_id'].'_avatar_big.jpg';
			}else{
				$data['photo'] = '/static/zhsjr/mobile/images/mem_1.gif';
			}
			// 用户名
			//$data['username'] = $user['username'];
			// 投标收益总计
			$data['user_acnt']['income_total'] =  $this->account->income_total($userid);
			// 投标总额 = 理财资产
			$data['user_acnt']['invite_total'] = $this->Borrow_model->tender_total($userid);
			$data['tab'] = 2;
			$this->load->view('zhs_mobile/member',$data);
		}else{
			header('Location: /zhs_mobile/login/index.html');
		}
	}
	
	// 修改登录密码
	function xglogin(){
		$user = $this->session->userdata('rsh_user');
		$data = Array();
		if(isset($user['user_id']) && $user['user_id'] > 0){
			
		}else{
			header('Location: /zhs_mobile/login/index.html');
		}
		$data['tab'] = 2;
		$this->load->view('zhs_mobile/xglogin',$data);
	}
	
	// 查询交易密码
	function jylogin(){
		$user = $this->session->userdata('rsh_user');
		$data = Array();
		if(isset($user['user_id']) && $user['user_id'] > 0){
			
		}else{
			header('Location: /zhs_mobile/login/index.html');
		}
		$data['tab'] = 2;
		$this->load->view('zhs_mobile/jylogin',$data);
	}	
	
	// 查询实名认证信息
	function name(){
		$user = $this->session->userdata('rsh_user');
		$data = Array();
		if(isset($user['user_id']) && $user['user_id'] > 0){
			// 1.获取用户信息
			$userid = $user['user_id'];
			// 基本资料（一级）
			$this->load->model('User_model');
			$data['userInfo'] = $this->User_model->get_by_uid($userid);
			
			if(isset ($data['userInfo'] ) && $data['userInfo']['real_status'] == 0 ){
				$ret['msg'] = '敬请登陆一点投PC端官网实名认证';
				$ret['url_title'] = '返回';
				$ret['url_next']="/zhs_mobile/ucenter.html";
				$this->load->view('zhs_mobile/msg',$ret);
				return ;
			}else{
				//TODO 
			}
		}else{
			header('Location: /zhs_mobile/login/index.html');
		}
		$data['tab'] = 2;
		$this->load->view('zhs_mobile/name',$data);
	}
	
	// 查询手机认证信息
	function tel(){
		$user = $this->session->userdata('rsh_user');
		$data = Array();
		if(isset($user['user_id']) && $user['user_id'] > 0){
			// 1.获取用户信息
			$userid = $user['user_id'];
			// 基本资料（一级）
			$this->load->model('User_model');
			$data['userInfo'] = $this->User_model->get_by_uid($userid);
			
			if(isset ($data['userInfo'] ) && $data['userInfo']['phone_status']==0){
				$ret['msg'] = '敬请登陆一点投PC端官网手机认证';
				$ret['url_title'] = '返回';
				$ret['url_next']="/zhs_mobile/ucenter.html";
				$this->load->view('zhs_mobile/msg',$ret);
				return ;
			}
		}else{
			header('Location: /zhs_mobile/login/index.html');
		}
		$data['tab'] = 2;
		$this->load->view('zhs_mobile/tel',$data);
	}
	
	// 前往充值页面
	function recharge(){
		$user = $this->session->userdata('rsh_user');
		if(isset($user['user_id']) && $user['user_id'] > 0){
			$ret['msg'] = '敬请前往一点投金融PC端官网充值';
			$ret['url_title'] = '返回';
			$ret['url_next']="/zhs_mobile/ucenter.html";
			$this->load->view('zhs_mobile/msg',$ret);
		}else{
			header('Location: /zhs_mobile/login/index.html');
		}
	}
	
	// 前往提现页面
	function cash(){
		$user = $this->session->userdata('rsh_user');
		if(isset($user['user_id']) && $user['user_id'] > 0){
			$this->load->model('User_model', 'user');
			$this->load->model('Account_bank_model', 'bank');
			$this->load->model('Account_model', 'account');
			$this->load->model('Accountlog_model', 'accountlog');
			
			$data['user'] = $this->user->get_by_uid($user['user_id']);
			$data['bank_list'] = $this->bank->arrays('var_account_bank');
			$data['account'] = $this->account->get_account($user['user_id']);
			$data['bank'] = $this->bank->get_by_uid($user['user_id']);
			$data['cash_fee'] = $this->accountlog->cash_fee($user['user_id']);
			$data['cash_fee'] = min($data['cash_fee'],$data['account']['use_money']);
			
			if($data['user']['real_status'] != 1){
				$ret['msg'] = '尚未实名认证';
				$ret['url_title'] = '返回用户中心';
				$ret['url_next']="/zhs_mobile/ucenter.html";
				$this->load->view('zhs_mobile/msg',$ret);
				return;
			}elseif ((!isset($data['bank'])) || count($data['bank']) == 0 ){
				$ret['msg'] = '尚未填写银行账户';
				$ret['url_title'] = '返回用户中心';
				$ret['url_next']="/zhs_mobile/ucenter.html";
				$this->load->view('zhs_mobile/msg',$ret);
				return;
			}elseif (!$data['user']['paypassword']){
				$ret['msg'] = '尚设置交易密码';
				$ret['url_title'] = '返回用户中心';
				$ret['url_next']="/zhs_mobile/ucenter.html";
				$this->load->view('zhs_mobile/msg',$ret);
				return;
			}
			$data['tab'] = 2;
			$this->load->view('zhs_mobile/txye',$data);
		}else{
			header('Location: /zhs_mobile/login/index.html');
		}
	}
	
	// 充值日志
	function recharge_log(){
		$user = $this->session->userdata('rsh_user');
		$data = Array();
			$this->load->view('zhs_mobile/cz',$data);
			$ret['msg'] = '敬请登陆一点投金融PC端官网充值';
			$ret['url_title'] = '前往 用户中心';
			$ret['url_next']="/zhs_mobile/login/index.html";
			$this->load->view('zhs_mobile/msg',$ret);
	}
	
	// 提现日志
	function cash_log(){
		$user = $this->session->userdata('rsh_user');
		if(isset($user['user_id']) && $user['user_id'] > 0){
			$ret['msg'] = '敬请登陆一点投金融PC端官网充值';
			$ret['url_title'] = '前往 用户中心';
			$ret['url_next']="/zhs_mobile/ucenter.html";
			$this->load->view('zhs_mobile/msg',$ret);
		}else{
			header('Location: /zhs_mobile/login/index.html');
		}
		$data['tab'] = 2;
		$this->load->view('zhs_mobile/tx',$data);
	}
	
	// 资金日志
	function account_log(){
		$user = $this->session->userdata('rsh_user');
		if(isset($user['user_id']) && $user['user_id'] > 0){
			$ret['msg'] = '敬请登陆一点投金融PC端官网充值';
			$ret['url_title'] = '前往 用户中心';
			$ret['url_next']="/zhs_mobile/ucenter.html";
			$this->load->view('zhs_mobile/msg',$ret);
		}else{
			header('Location: /zhs_mobile/login/index.html');
		}
		$data['tab'] = 2;
		$this->load->view('zhs_mobile/zj',$data);
	}
	
	// 投资日志
	function tender_log(){
		$user = $this->session->userdata('rsh_user');
		if(isset($user['user_id']) && $user['user_id'] > 0){
			$ret['msg'] = '敬请登陆一点投金融PC端官网充值';
			$ret['url_title'] = '前往 用户中心';
			$ret['url_next']="/zhs_mobile/ucenter.html";
			$this->load->view('zhs_mobile/msg',$ret);
		}else{
			header('Location: /zhs_mobile/login/index.html');
		}
		$data['tab'] = 2;
		$this->load->view('zhs_mobile/tz',$data);
	}
	
	function zhs_bank(){
		$user = $this->session->userdata('rsh_user');
		$this->load->model('Account_bank_model', 'bank');
		$this->load->model('Area_model', 'area');
		$bank = $this->bank->get_by_uid($user['user_id']);
		$data['bank_list'] = $this->bank->arrays('var_account_bank');
		$data['area'] = $this->area->get_list();
		
		if(count($bank)<=0){
			$ret['msg'] = '敬请登陆一点投PC端绑定银行卡';
			$ret['url_title'] = '返回';
			$ret['url_next']="/zhs_mobile/ucenter.html";
			$this->load->view('zhs_mobile/msg',$ret);
			return ;
		}
		for($i=0; $i<count($bank); $i++){
			$data['bank'.$i] = $bank[$i];
		}
		$data['user'] = $user;
		$data['tab'] = 2;
		$this->load->view('zhs_mobile/bank',$data);
	}
>>>>>>> d47623b610d79a4eeb489500830c00d70933f414
}